package io.zhifei.modules.sys.system.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.zhifei.common.utils.PageUtils;
import io.zhifei.modules.sys.system.dao.SysProblemDao;
import io.zhifei.modules.sys.system.entity.ProblemEntity;
import io.zhifei.modules.sys.system.service.SysProblemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p> 常见问题管理 </p>
 *
 * @author： WangPeng <br/>
 * @date： 2020/10/12 15:18 <br/>
 * @version： <br/>
 */
@Service
public class SysProblemServiceImpl extends ServiceImpl<SysProblemDao, ProblemEntity> implements SysProblemService {

    @Autowired
    private SysProblemDao problemDao;

    @Override
    public PageUtils queryList(Integer page, Integer pageSize) {
        Page pageParam = new Page(page, pageSize);
        Page<Map<String, Object>> pageResult = problemDao.problemList(pageParam);
        return new PageUtils(pageResult);
    }

    @Override
    public void insert(ProblemEntity problemEntity) {
        problemDao.insert(problemEntity);
    }

    @Override
    public void update(ProblemEntity problemEntity) {
        problemDao.updateById(problemEntity);
    }

    @Override
    public void delete(List<String> ids) {
        problemDao.deleteBatchIds(ids);
    }

    @Override
    public PageUtils questionFeedback(Integer page, Integer pageSize) {
        Page pageParam = new Page(page, pageSize);
        Page<Map<String, Object>> pageResult = problemDao.questionFeedback(pageParam);
        return new PageUtils(pageResult);
    }
}
